package com.atguigu.spzx.product.api;

import com.atguigu.spyx.model.common.Result;
import com.atguigu.spyx.model.common.com.atguigu.spyx.model.entity.h5.OrderItem;
import com.atguigu.spyx.model.common.com.atguigu.spyx.model.entity.product.ProductSku;
import com.atguigu.spzx.product.api.fallback.ProductClientFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

@FeignClient(value = "service-product" , fallback = ProductClientFallback.class)
public interface ProductClient {

    // feign客户端远程调用返回的结果  如果没有设置泛型，默认转为LinkedHashMap
    @GetMapping("/api/product/findById/{id}")
    public Result<ProductSku> findById(@PathVariable("id")Long id);

    @PutMapping("/api/product/updateSalesAndStock")
    public Result updateSalesAndStock(@RequestBody List<OrderItem> orderItems);



}